You can set initial value for WebInput from code behind.
In this topic, you will learn how to set different initial value WebInput.
To set simple input initial value
- Drag WebInput instance to WebForm.
- In Page_Load event handler function, put the following code:
-
C# Copy Code
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { wiSimpleInput.Value="simple alphanumeric text for webinput 1234567890"; } }
To set DateTimeFree input initial value
- Drag WebInput instance to WebForm.
- In Page_Load event handler function, put the following code:
-
C# Copy Code
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { wiDateTimeFreeInput.Value = new DateTime(2007, 1, 1); } }
To set DateTimeMasked input initial value
- Drag WebInput instance to WebForm.
- In Page_Load event handler function, put the following code:
-
C# Copy Code
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { wiDateTimeMaskedInput.Value = new DateTime(2007, 1, 31);
} }
To set Number input initial value
- Drag WebInput instance to WebForm.
- In Page_Load event handler function, put the following code:
-
C# Copy Code
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { wiNumberInput.Value = 12345; } }
To set DynamicCurrency input initial value
- Drag WebInput instance to WebForm.
- In Page_Load event handler function, put the following code:
-
C# Copy Code
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { decimal currencyValue = 1000000000000000000000m; wiDynamicCurrencyInput.Value = currencyValue; } }